package com.mcc.myapplication

val eps = 1E-10 // "good enough", could be 10^-15

tailrec fun findFixPoint(x: Double = 1.0): Double =
    if (Math.abs(x - Math.cos(x)) < eps) x else findFixPoint(Math.cos(x))

data class Obj(val name: String)

/**
 * 伴生类
 */
class F {
    companion object {

        val a = 1024
        const val b = 1000

        @JvmStatic
        val c = 999
        fun test() {
            println("F.test()")
        }

        @JvmStatic
        fun test2() {
            println("@JvmStatic F.test2()")
        }
    }

}

enum class Color(val rgb: String) {
    RED("#FF0000"),
    GREEN("#00FF00"),
}

fun main() {
    println(findFixPoint(1.57))
    val obj = Obj("Mcc")
    obj.toString().also { println(it) }
    println(obj)

    F.test()
    F.Companion.test()
    println(F.a)
    println(F.b)
    println(F.c)

    println(Color.GREEN.rgb)
    println(Color.GREEN.name)
}